local ServerOHOH = _G.ServerOHOH;
local M = ServerOHOH.class.new(script, ServerOHOH.files.Server_PlayerComponent(),script.Parent.Name);
local ItemTool=_G.CommonOHOH.load.ItemTool();
local PetTool=_G.CommonOHOH.load.PetTool();
local Good_Cfg=ServerOHOH.config.Goods

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
    self.player=self.parent
	self.DataBase=self.parent:GetComponent(ServerOHOH.load.Server_PlayerDataComponent())
    self.ItemCtrl=self.parent:GetComponent(ServerOHOH.load.Server_ItemCtrl())

    for _, v in pairs(script.Parent.handle:GetChildren()) do
        self.player:AddPrivateComponent(v)
    end

end;

--检查商品能否购买
function M.Check(self, gid,...)
   local cfg= Good_Cfg[gid]

    local list= self.player.CanNotRobuxBuyEvent:Action(gid,cfg.gType,...)
    for _,v in pairs(list) do
        if v then
            return false
        end
    end
    return true
 end;
 
 --购买成功，发放某商品
 function M.Buy(self, gid,...)
   local cfg= Good_Cfg[gid]
    self.player.RobuxBuyDoneEvent:Action(gid,cfg.gType,...)
    return true
 end;
 



return M
